package com.sinosoft.cnmuseum.servlets;


import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;

import com.sinosoft.cnmuseum.dao.MbGyCyyzDao;
import com.sinosoft.cnmuseum.dao.MbGyFileDao;
import com.sinosoft.cnmuseum.dao.MbGyJljzlxDao;
import com.sinosoft.cnmuseum.dao.MbGyLyfsDao;
import com.sinosoft.cnmuseum.dao.MbGyPsjdDao;
import com.sinosoft.cnmuseum.dao.MbGyWjgsDao;
import com.sinosoft.cnmuseum.dao.MbManageImageDao;
import com.sinosoft.cnmuseum.dao.MbManageImagelistDao;
import com.sinosoft.cnmuseum.dao.MbManageResourceprivilegeDao;
import com.sinosoft.cnmuseum.dao.MbManageResourceresponsiblepersonDao;
import com.sinosoft.cnmuseum.entity.MbGyFile;
import com.sinosoft.cnmuseum.entity.MbManageImage;
import com.sinosoft.cnmuseum.entity.MbManageResourceprivilege;
import com.sinosoft.cnmuseum.entity.MbManageResourceresponsibleperson;
import com.sinosoft.cnmuseum.entity.MbXtglLog;
import com.sinosoft.cnmuseum.entity.MbXtglYhxx;
import com.sinosoft.cnmuseum.servlets.i.IServlet;
import com.sinosoft.cnmuseum.utils.LogUtils;
import com.sinosoft.cnmuseum.utils.MultipartFile;
import com.sinosoft.cnmuseum.utils.PageUtil;
import com.sinosoft.cnmuseum.utils.ResourceUploadUtils;
import com.sinosoft.cnmuseum.utils.Status;
import com.sinosoft.cnmuseum.utils.StringUtils;
import com.sinosoft.commontools.annotated.TransAnnotation;
import com.sinosoft.commontools.annotated.rquestMethod;
import com.sinosoft.commontools.annotated.rquestMethod.ReqMode;
import com.sinosoft.commontools.record.Record;

public class MbManageImageServlet  implements IServlet{
	
	private static Logger logger = Logger.getLogger(MbManageImageServlet.class);

	@Override
	@rquestMethod(MethodNote = ReqMode.All)
	public Record getData(HttpServletRequest request, HttpServletResponse response, Record data) {
		 Record result = new Record();
		try {
		   
//		    MbManageResourceprivilegeDao mbManageResourceprivilegeDao = new MbManageResourceprivilegeDao();
//		    MbManageResourceresponsiblepersonDao mbManageResourceresponsiblepersonDao= new MbManageResourceresponsiblepersonDao();
//		    MbManageImageDao dao = new MbManageImageDao();
//		    
//			//获取当前登录用户
//			HttpSession session = request.getSession(false);	
//			String nowcontributor = (String) session.getAttribute(Status.SESSION_USERID);//责任者					  			  		
//	  		String countsql = " SELECT COUNT(*)  as count FROM "+MbManageResourceprivilege.MB_MANAGE_RESOURCEPRIVILEGE_TABLE_NAME+" AS a, "+MbManageResourceresponsibleperson.MB_MANAGE_RESOURCERESPONSIBLEPERSON_TABLE_NAME+" AS b, "+MbManageImage.MB_MANAGE_IMAGE_TABLE_NAME+" AS c  WHERE a.file_zdbh=b.file_zdbh AND b.file_zdbh=c.fileid  AND a.rightsHolder='"+nowcontributor+"'";
//	  		String sql = " SELECT c.zdbh AS zdbh,b.file_zdbh AS file_zdbh FROM "+MbManageResourceprivilege.MB_MANAGE_RESOURCEPRIVILEGE_TABLE_NAME+" AS a, "+MbManageResourceresponsibleperson.MB_MANAGE_RESOURCERESPONSIBLEPERSON_TABLE_NAME+" AS b, "+MbManageImage.MB_MANAGE_IMAGE_TABLE_NAME+" AS c WHERE a.file_zdbh=b.file_zdbh AND b.file_zdbh=c.fileid  AND a.rightsHolder='"+nowcontributor+"'";
//			String ordersql = " order by zdbh desc ";
//			String limitsql = " limit ";						
//			// 这里是获取分页参数，可以前端自己定义
//			int pagenumber = data.getIntValue(Status.PAGENUMBER);// 获取当前页
//			int pagesize = data.getIntValue(Status.PAGESIZE);// 获取每页多少条数据	
//			List<Record> countlist = mbManageResourceprivilegeDao.getBySql(countsql);
//			int total = countlist.get(0).getIntValue("count");
//			PageUtil page = new PageUtil(pagenumber, pagesize, total);
//			limitsql += page.getStart()+","+pagesize;
//			List<Record> mbManageResourceprivilegeList = mbManageResourceprivilegeDao.getBySql(sql+ordersql+limitsql);
//			List<Record> list = new ArrayList<Record>();			
//			String resourcetype = "1";//资源类型
//			if (mbManageResourceprivilegeList != null && mbManageResourceprivilegeList.size() > 0) {
//				for (Record mbManageResourceprivilege : mbManageResourceprivilegeList) {
//					HashMap<String, Object> parameter = new HashMap<String, Object>();
//
//					String fileid = mbManageResourceprivilege.getStrValue("file_zdbh");
//					String rightsType = mbManageResourceprivilege.getStrValue("rightsType");
//					String rightsHolder = mbManageResourceprivilege.getStrValue("rightsHolder");
//					// 根据文件id查询列表
//					parameter.put("file_zdbh", fileid);
//					parameter.put("resourcetype", resourcetype);
//
//					List<Record> mbManageResourceresponsiblepersonList = mbManageResourceresponsiblepersonDao.getListByProperty(parameter);
//					if (mbManageResourceresponsiblepersonList != null && mbManageResourceresponsiblepersonList.size() > 0) {
//
//						Record mbManageResourceresponsibleperson = mbManageResourceresponsiblepersonList.get(0);
//						if (mbManageResourceresponsibleperson != null) {
//							String contributortype = mbManageResourceresponsibleperson.getStrValue("contributortype");
//							String contributor = mbManageResourceresponsibleperson.getStrValue("contributor");
//							String role = mbManageResourceresponsibleperson.getStrValue("role");
//							String roleNote = mbManageResourceresponsibleperson.getStrValue("roleNote");
//							String contributorDescription = mbManageResourceresponsibleperson.getStrValue("contributorDescription");
//							String contributorID = mbManageResourceresponsibleperson.getStrValue("contributorID");
//							String newfileid = mbManageResourceresponsibleperson.getStrValue("file_zdbh");
//							Record parameter2 = new Record();
//							parameter2.add("fileid", newfileid);
//							List<Record> mbManageImageList = dao.getListByProperty(parameter2);
//							if (mbManageImageList != null && mbManageImageList.size() > 0) {
//								Record mbManageImage = mbManageImageList.get(0);
//								mbManageImage.add("rightsType", rightsType);
//								mbManageImage.add("rightsHolder", rightsHolder);
//								mbManageImage.add("resourcetype", resourcetype);
//								mbManageImage.add("contributortype", contributortype);
//								mbManageImage.add("contributor", contributor);
//								mbManageImage.add("role", role);
//								mbManageImage.add("roleNote", roleNote);
//								mbManageImage.add("contributorDescription", contributorDescription);
//								mbManageImage.add("contributorID", contributorID);
//								list.add(mbManageImage);
//							}
//
//						}
//
//					}
//
//				}
//			}				
//			// 组装数据
//			result.add(Status.ROWS, list);
//			result.add(Status.TOTAL, total);
//			result.add(Status.PAGENUMBER, pagenumber);
//			result.add(Status.PAGESIZE, pagesize);
//			result.add(Status.PAGETOTAL, page.getPagetotal());
//			// 返回接口调用成功标识
//			result.add(Status.SATUS,Status.OK);
		
			
			
//			MbManageImagelistDao dao = new MbManageImagelistDao();
//			// 获取当前登录用户
//			HttpSession session = request.getSession(false);
//			String nowcontributor = (String) session.getAttribute(Status.SESSION_USERID);// 责任者
//			HashMap<String, Object> map = new HashMap<String, Object>();
//			map.put("rightsHolder", nowcontributor);
//			// 这里是获取分页参数，可以前端自己定义
//			int pagenumber = data.getIntValue(Status.PAGENUMBER);// 获取当前页
//			int pagesize = data.getIntValue(Status.PAGESIZE);// 获取每页多少条数据
//			result = dao.getPageByProperty(map, pagenumber, pagesize, "zdbh", false);
//			// 返回接口调用成功标识
//			result.add(Status.SATUS, Status.OK);
			
			
			
			
			MbManageImagelistDao dao = new MbManageImagelistDao();
			// 获取当前登录用户
			HttpSession session = request.getSession(false);
			String nowcontributor = (String) session.getAttribute(Status.SESSION_USERID);// 责任者
			if(StringUtils.isNoEmpty(nowcontributor)) {
				String countsql = " SELECT COUNT(*)  as count FROM mb_manage_imagelist AS a WHERE  a.rightsHolder='"+nowcontributor+"'";
		  		String sql = " SELECT * FROM  mb_manage_imagelist AS a WHERE  a.rightsHolder='"+nowcontributor+"'";
				String ordersql = " order by zdbh desc ";
				String limitsql = " limit ";
				String title = data.getStrValue(MbManageImage.TITLE);
				String subject = data.getStrValue(MbManageImage.SUBJECT);
				String fileFormat = data.getStrValue(MbManageImage.FILEFORMAT);
				String rightsType = data.getStrValue(MbManageImage.RIGHTSTYPE);
				String kssj = data.getStrValue(MbManageImage.KSSJ);
				String jssj = data.getStrValue(MbManageImage.JSSJ);
				if(StringUtils.isNoEmpty(title)) {
					countsql += " and "+MbManageImage.TITLE+"  like '%"+title+"%' ";
					sql += " and "+MbManageImage.TITLE+" like '%"+title+"%' ";
				}
				if(StringUtils.isNoEmpty(subject)) {
					countsql += " and "+MbManageImage.SUBJECT+" like '%"+subject+"%' ";
					sql += " and "+MbManageImage.SUBJECT+" like '%"+subject+"%' ";
				}
				if(StringUtils.isNoEmpty(fileFormat)) {
					countsql += " and "+MbManageImage.FILEFORMAT+" = "+fileFormat+" ";
					sql += " and "+MbManageImage.FILEFORMAT+" = "+fileFormat+" ";
				}
				if(StringUtils.isNoEmpty(rightsType)) {
					countsql += " and "+MbManageImage.RIGHTSTYPE+" = "+rightsType+" ";
					sql += " and "+MbManageImage.RIGHTSTYPE+" = "+rightsType+" ";
				}
				if(StringUtils.isNoEmpty(kssj)){
					countsql += " and "+MbManageImage.CREATED+" > '"+kssj+ " 00:00:00'";
					sql += " and "+MbManageImage.CREATED+" > '"+kssj+ " 00:00:00'";
				}
				if(StringUtils.isNoEmpty(jssj)){
					countsql += " and "+MbManageImage.CREATED+" < '"+jssj + " 23:59:59'";
					sql += " and "+MbManageImage.CREATED+" < '"+jssj + " 23:59:59'";
				}
				// 这里是获取分页参数，可以前端自己定义
				int pagenumber = data.getIntValue(Status.PAGENUMBER);// 获取当前页
				int pagesize = data.getIntValue(Status.PAGESIZE);// 获取每页多少条数据	
				List<Record> countlist = dao.getBySql(countsql);
				int total = countlist.get(0).getIntValue("count");
				PageUtil page = new PageUtil(pagenumber, pagesize, total);
				limitsql += page.getStart()+","+pagesize;		
				List<Record> list = dao.getBySql(sql+ordersql+limitsql);
				// 组装数据
				result.add(Status.ROWS, list);
				result.add(Status.TOTAL, total);
				result.add(Status.PAGENUMBER, pagenumber);
				result.add(Status.PAGESIZE, pagesize);
				result.add(Status.PAGETOTAL, page.getPagetotal());
				// 返回接口调用成功标识
				result.add(Status.SATUS,Status.OK);
			}else {
				throw new Exception("用户未登录！");
			}				
		} catch (Exception e) {
			// 返回接口调用失败标识
			result.add(Status.SATUS,Status.FAILED);
			// 返回接口调用失败信息，需要自己添加
			result.add(Status.MSG,"查询失败！");
		}
		// 接口返回Record对象，框架会自动封装返回给请求result对象中的数据
	    return result;		 
	}

	@rquestMethod(MethodNote = ReqMode.All)
	public Record getOneDetail(HttpServletRequest request, HttpServletResponse response, Record data) {
		
		 Record result = new Record();
			try {
//			    MbManageImageDao dao = new MbManageImageDao();
//			    Record mbManageImage = dao.getById(data.getIntValue("zdbh"));
//			    String fileid = mbManageImage.getStrValue("fileid");
//			    String medium = mbManageImage.getStrValue("medium");
//			    String fileFormat = mbManageImage.getStrValue("fileFormat");
//			    String sourceType = mbManageImage.getStrValue("sourceType");
//			    String language = mbManageImage.getStrValue("language");
//			    String angel = mbManageImage.getStrValue("angel");
//			    //文件名称
//			    if(StringUtils.isNoEmpty(fileid)) {
//			    	MbGyFileDao fileDao = new MbGyFileDao();	
//					String sql = "select * from "+MbGyFile.MB_GY_FILE_TABLE_NAME+" where 1=1 and "+MbGyFile.ID+"='"+fileid+"' ";
//					List<Record> fileList = fileDao.getBySql(sql);	
//					if(fileList!=null && fileList.size()>0) {
//						Record file = fileList.get(0);
//						String filename = file.getStrValue("filename");	
//						mbManageImage.add("filename", filename);
//					}else {
//						mbManageImage.add("filename", null);
//					}
//			    }
//			    //记录介质类型
//			    if(StringUtils.isNoEmpty(medium)){
//			    	MbGyJljzlxDao mbGyJljzlxDao=new MbGyJljzlxDao();
//			    	int mediumid = Integer.parseInt(medium);
//					Record mbGyJljzlx = mbGyJljzlxDao.getById(mediumid);
//					String mediumname = mbGyJljzlx.getStrValue("name");
//					mbManageImage.add("mediumname", mediumname);
//	        	}
//			    //文件格式
//			    if(StringUtils.isNoEmpty(fileFormat)){
//			    	 MbGyWjgsDao  mbGyWjgsDao=new MbGyWjgsDao();
//			    	 int fileFormatid = Integer.parseInt(fileFormat);
//			    	 Record mbGyWjgs = mbGyWjgsDao.getById(fileFormatid);
//			    	 String fileFormatname = mbGyWjgs.getStrValue("name");
//			    	 mbManageImage.add("fileFormatname", fileFormatname);			    	 
//			    }
//			    //来源方式基表
//			    if(StringUtils.isNoEmpty(sourceType)){
//			    	 MbGyLyfsDao  mbGyLyfsDao=new MbGyLyfsDao();
//			    	 int sourceTypeid = Integer.parseInt(sourceType);
//			    	 Record mbGyLyfs = mbGyLyfsDao.getById(sourceTypeid);
//			    	 String sourceTypename = mbGyLyfs.getStrValue("name");
//			    	 mbManageImage.add("sourceTypename", sourceTypename);			    	 
//			    }
//			    //常用语种基表
//			    if(StringUtils.isNoEmpty(language)){
//			    	MbGyCyyzDao  mbGyCyyzDao=new MbGyCyyzDao();
//			    	 int languageid = Integer.parseInt(language);
//			    	 Record mbGyCyyz = mbGyCyyzDao.getById(languageid);
//			    	 String languagename = mbGyCyyz.getStrValue("name");
//			    	 mbManageImage.add("languagename", languagename);			    	 
//			    }
//			    //拍摄角度
//			    if(StringUtils.isNoEmpty(angel)){
//			    	 MbGyPsjdDao  mbGyPsjdDao=new MbGyPsjdDao();
//			    	 int angelid = Integer.parseInt(angel);
//			    	 Record mbGyPsjd = mbGyPsjdDao.getById(angelid);
//			    	 String angelname = mbGyPsjd.getStrValue("name");
//			    	 mbManageImage.add("angelname", angelname);			    	 
//			    }
//
//				// 组装数据
//				result.add(Status.ROWS, mbManageImage);
//				// 返回接口调用成功标识
//				result.add(Status.SATUS,Status.OK);
				
			MbManageImagelistDao dao = new MbManageImagelistDao();
			int zdbh = data.getIntValue("zdbh");
			HashMap<String, Object> map = new HashMap<String, Object>();
			map.put("zdbh", zdbh);
			List<Record> mbManageImageList = dao.getListByProperty(map);
			if (mbManageImageList != null && mbManageImageList.size() > 0) {
				Record mbManageImage = mbManageImageList.get(0);
				// 组装数据
				result.add(Status.ROWS, mbManageImage);
				// 返回接口调用成功标识
				result.add(Status.SATUS, Status.OK);
			} 
				
			} catch (Exception e) {
				// 返回接口调用失败标识
				result.add(Status.SATUS,Status.FAILED);
				// 返回接口调用失败信息，需要自己添加
				result.add(Status.MSG,"查询失败！");
			}
			// 接口返回Record对象，框架会自动封装返回给请求result对象中的数据
		    return result;	
	}
	
	@Override
	@rquestMethod(MethodNote = ReqMode.All)
	@TransAnnotation(isTrans=true)
	public Record insert(HttpServletRequest request, HttpServletResponse response, Record data) {
	  Record result = new Record();
	  String zdbhs = "";
      String filetitles = "";
	  try {
	    MbManageImageDao dao = new MbManageImageDao();
	    Record mbManageResourceResponsiblePerson = new Record();
	    Record mbManageResourcePrivilege = new Record();		
	    HttpSession session = request.getSession(false);	
	    String contributor = (String) session.getAttribute(Status.SESSION_USERID);//责任者
	    String rightsType = data.getStrValue("rightsType");
	    String fileids = data.getStrValue("fileid");
	    String[] datafileids = fileids.split(",");
	    if(datafileids.length>0 && datafileids!=null) {
	      for (String file_zdbh : datafileids) {
	        MultipartFile multipartFile =new MultipartFile();
	        Record file = multipartFile.getFileDetailData(file_zdbh);
	        
	        String extent_h =  file.getStrValue("height");
	        String extent_w =  file.getStrValue("width");
	        String size =  file.getStrValue("s_kb");			
	        //影像表
	        int scbz=0;//有效
	        data.add("scbz", scbz);
	        data.add("fileid", file_zdbh);
	        data.add("extent_h", extent_h);
	        data.add("extent_w", extent_w);
	        data.add("size", size);
	        
	        //资源责任人
	        int  resourcetype=1;//影像 1
	        int  contributortype=1;//创建者:1
	        mbManageResourceResponsiblePerson.add("contributor", contributor);//责任者
	        mbManageResourceResponsiblePerson.add("file_zdbh", file_zdbh);//资源id
	        mbManageResourceResponsiblePerson.add("resourcetype", resourcetype);//资源类型
	        mbManageResourceResponsiblePerson.add("contributortype", contributortype);//责任类别
	        //资源权限			
	        
	        mbManageResourcePrivilege.add("rightsType", rightsType);//权限类型
	        mbManageResourcePrivilege.add("rightsHolder", contributor);//权限持有者
	        mbManageResourcePrivilege.add("file_zdbh", file_zdbh);//
	        
	        data.RemoveValue("rightsType");
	        data.add("published", new Date());
	        if(dao.insert(data)) {
	          
	          LogUtils logUtils= new LogUtils();
	          String desc=LogUtils.MbManageImage_INSERT_DESC;
	          logUtils.addLog(String.valueOf(LogUtils.type_insert), LogUtils.model_zy, contributor, desc);
	          
	          ResourceUploadUtils resourceUploadUtils =new ResourceUploadUtils();
	          //插入资源责任人
	          resourceUploadUtils.insertMbManageResourceResponsiblePerson(mbManageResourceResponsiblePerson);
	          //插入资源权限
	          resourceUploadUtils.insertMbManageResourcePrivilege(mbManageResourcePrivilege);
	          result.add(Status.SATUS,Status.OK);
	          zdbhs+=data.getValue("zdbh")+",";
              filetitles+=data.getValue("title")+":";
	        } else {
	          throw new Exception("插入信息失败！");
	        }																
	      }
	    }			
	  }catch (Exception e) {
	    logger.error(e.getMessage());
	    e.printStackTrace();
	    // 事务回滚，事务模式下，此标识将使此次事务回滚
	    result.add(Status.SATUS, Status.FAILED);
	  }
      if(zdbhs.length()>0){
        result.add("zdbh", zdbhs.substring(0, zdbhs.length()-1));
        result.add("filetitles", filetitles.substring(0, filetitles.length()-1));
      }
	  return result;
	  
	}
	

	//设置有效 0
	@rquestMethod(MethodNote = ReqMode.All)
	@TransAnnotation(isTrans=true)
	public Record setvalid(HttpServletRequest request, HttpServletResponse response, Record data) {
	    Record result = new Record();
	    try {
	    	MbManageImageDao dao = new MbManageImageDao();
	        Record gydata = dao.getById(data.getIntValue("zdbh"));
	        if(gydata!=null) {
	        	int scbz=0;
	        	gydata.add("scbz", scbz);
				if (dao.update(gydata)) {
			         result.add(Status.SATUS,Status.OK);
			        } else {
			            throw new Exception("设置有效信息失败！");
			        }
	        }      
	    } catch (Exception e) {
	        logger.error(e.getMessage());
	        e.printStackTrace();
	        // 事务回滚，事务模式下，此标识将使此次事务回滚
	        result.add(Status.SATUS, Status.FAILED);
	    }
	    return result;
	}
	//设置无效 1 
	@rquestMethod(MethodNote = ReqMode.All)
	@TransAnnotation(isTrans=true)
	public Record setinvalid(HttpServletRequest request, HttpServletResponse response, Record data) {
	    Record result = new Record();
	    try {
	    	MbManageImageDao dao = new MbManageImageDao();
	        Record gydata = dao.getById(data.getIntValue("zdbh"));
	        if(gydata!=null) {
	        	int scbz=1;
	        	gydata.add("scbz", scbz);
				if (dao.update(gydata)) {
			         result.add(Status.SATUS,Status.OK);
			        } else {
			            throw new Exception("设置无效信息失败！");
			        }
	        }      
	    } catch (Exception e) {
	        logger.error(e.getMessage());
	        e.printStackTrace();
	        // 事务回滚，事务模式下，此标识将使此次事务回滚
	        result.add(Status.SATUS, Status.FAILED);
	    }
	    return result;
	}

		
	@Override
	@rquestMethod(MethodNote = ReqMode.All)
	@TransAnnotation(isTrans=true)
	public Record update(HttpServletRequest request, HttpServletResponse response, Record data) {
	    Record result = new Record();
	    try {
	    	MbManageImageDao dao = new MbManageImageDao();
	    	MbManageResourceprivilegeDao mbManageResourceprivilegeDao = new MbManageResourceprivilegeDao();
			MbManageResourceresponsiblepersonDao mbManageResourceresponsiblepersonDao= new MbManageResourceresponsiblepersonDao();
			HttpSession session = request.getSession(false);	
			String contributor = (String) session.getAttribute(Status.SESSION_USERID);//责任者
	        Record gydata = dao.getById(data.getIntValue("zdbh"));
	        	        
	        if(gydata!=null) {
        		        	        	
				if (dao.update(data)) {
					//插入日志
		        	LogUtils logUtils= new LogUtils();
		        	String desc=LogUtils.MbManageImage_UPDATE_DESC;
		        	logUtils.addLog(String.valueOf(LogUtils.type_update), LogUtils.model_zy, contributor, desc);
					
					
					String oldfile_zdbh = gydata.getStrValue("fileid");
					String newfile_zdbh = data.getStrValue("fileid");
					ResourceUploadUtils resourceUploadUtils =new ResourceUploadUtils();
					Record parameter = new Record();
					parameter.add("file_zdbh", oldfile_zdbh);
					List<Record> mbManageResourceprivilegeList = mbManageResourceprivilegeDao.getListByProperty(parameter);
					if(mbManageResourceprivilegeList!=null && mbManageResourceprivilegeList.size()>0) {
						Record mbManageResourceprivilege = mbManageResourceprivilegeList.get(0);
						mbManageResourceprivilege.add("file_zdbh", newfile_zdbh);
						//更新资源权限
			        	resourceUploadUtils.updateMbManageResourcePrivilege(mbManageResourceprivilege);
					}
					List<Record> mbManageResourceresponsiblepersonList = mbManageResourceresponsiblepersonDao.getListByProperty(parameter);
					if(mbManageResourceresponsiblepersonList!=null && mbManageResourceresponsiblepersonList.size()>0) {
						Record mbManageResourceresponsibleperson = mbManageResourceresponsiblepersonList.get(0);
						mbManageResourceresponsibleperson.add("file_zdbh", newfile_zdbh);
						//更新资源责任人
			        	resourceUploadUtils.updateMbManageResourceResponsiblePerson(mbManageResourceresponsibleperson);
					}						
			         result.add(Status.SATUS,Status.OK);
			        } else {
			            throw new Exception("更新信息失败！");
			        }
	        }else{
	        	result.add(Status.MSG,"无此数据！");
	        }      
	    } catch (Exception e) {
	        logger.error(e.getMessage());
	        e.printStackTrace();
	        // 事务回滚，事务模式下，此标识将使此次事务回滚
	        result.add(Status.SATUS, Status.FAILED);
	    }
	    return result;
	}

	@Override
	@rquestMethod(MethodNote = ReqMode.All)
	@TransAnnotation(isTrans=true)
	public Record delete(HttpServletRequest request, HttpServletResponse response, Record data) {
		   Record result = new Record();
		    try {
		    	MbManageImageDao dao = new MbManageImageDao();
		        Record gydata = dao.getById(data.getIntValue("zdbh"));
		        if(gydata!=null) {
		        	int scbz=1;
		        	gydata.add("scbz", scbz);
					if (dao.update(gydata)) {
				         result.add(Status.SATUS,Status.OK);
				        } else {
				            throw new Exception("设置有效信息失败！");
				        }
		        }      
		    } catch (Exception e) {
		        logger.error(e.getMessage());
		        e.printStackTrace();
		        // 事务回滚，事务模式下，此标识将使此次事务回滚
		        result.add(Status.SATUS, Status.FAILED);
		    }
		    return result;
	}
	
	public static void main(String[] args) {
		String test="a,b,";
		String[] split = test.split(",");
		for (String string : split) {
			System.out.println(string);
		}
		
	}

}
